/**
 * 
 */
package com.moon.jy;

import android.content.Intent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

import com.moon.jy.util.ExitApplication;

/**
 * xxxxx
 * 
 * @author paul.gaol
 * @date 2014-3-23
 */
public class BottomBarActivity extends AbstractActivity {
    ImageView home;
    ImageView tools;
    ImageView setting;

    
    /**
     * 底部操作条
     */
    public void initBottomBar() {
        ImageView home = (ImageView) findViewById(R.id.home);
        home.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(BottomBarActivity.this, MainActivity.class);
                startActivity(intent);
            }
        });
        
        ImageView tools = (ImageView) findViewById(R.id.tools);
        tools.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(BottomBarActivity.this, ToolsActivity.class);
                startActivity(intent);
            }
        });
        
        ImageView setting = (ImageView) findViewById(R.id.setting);
        setting.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(BottomBarActivity.this, SettingActivity.class);
                startActivity(intent);
            }
        });

    }

    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.main_opt, menu);
        return super.onCreateOptionsMenu(menu);
        // Inflate the menu; this adds items to the action bar if it is present.
        //getMenuInflater().inflate(R.menu.main, menu);
        //return true;
    }
    
    
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.menu_exit:
                ExitApplication.getInstance().exit();
                return true;
            
            default:
        }
        return super.onOptionsItemSelected(item);
    }
}
